package cn.zktr.Personnel.model.service.ouyangpeng;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.zktr.Personnel.model.dao.ouyangpeng.RetRcdDao;
import cn.zktr.Personnel.model.mappers.ouyangpng.PerRetRseMapper;
import cn.zktr.Personnel.model.pojos.PerRetRcd;
import cn.zktr.Personnel.model.pojos.PerRetWAlt;
import cn.zktr.Personnel.model.service.zhouyongcong.findService;
import cn.zktr.Personnel.model.service.zhouyongcong.saveService;
import cn.zktr.Personnel.model.service.zhouyongcong.monit.monitObj;
import cn.zktr.Personnel.model.service.zhouyongcong.monit.monitgetService;
import cn.zktr.Personnel.model.service.zhouyongcong.monit.monitsaveService;

/**
 * @author lenovo
 *对内招聘记录
 */
@Service
@Transactional(rollbackOn=Exception.class)
public class RetRcdService {
	@Autowired
	private RetRcdDao retrcddao;
	@Autowired
	private PerRetRseMapper rsemapper;
	@Autowired
	private monitsaveService mss;
	@Autowired
	private monitgetService mgs;
	@Autowired
	private findService fs;
	@Autowired
	private saveService ss;
	
	public Iterable<PerRetRcd> selectRcdAll(){
		return retrcddao.findAll();
	}
	//最终审核
	public List<PerRetRcd> selectzuizhong(){
		return rsemapper.selectzuizhong();
	}
	//最终审核通过
	public void zzshenhetg(Integer rcdid,Integer empid) {
		PerRetRcd walt=retrcddao.findById(rcdid).get();
		mgs.getPojos(walt);
		monitObj mo1 = new monitObj(false, false);
		mo1.setOld_obj(walt);
		PerRetRcd prr = new PerRetRcd();
		prr.setRcdstat("1");
		mo1.setNew_obj(prr);
		monitObj[] mo = {mo1};
		ss.save_Audit_id(10,empid,"员工入职审核", fs.findEmpid(empid).getEmpname()+"申请入职，请审核！");
		mss.save(empid, mo, 10);
		//retrcddao.save(walt);
	}
	//最终审核不通过
    public void zzshenhebutg(Integer rcdid) {
    	PerRetRcd walt=retrcddao.findById(rcdid).get();
    	walt.setRcdstat("2");
    	retrcddao.save(walt);
    }
}
